import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';


import { AddProductComponent } from './add-product/add-product.component';
import { ProductCateComponent } from './product-cate/product-cate.component';
import { ProductAttrComponent } from './product-attr/product-attr.component';
import { ProductComponent } from './product/product.component';
import { BrandComponent } from './brand/brand.component';
import { BrandAdderComponent } from './brand/brand-adder/brand-adder.component';
import { BrandUpdaterComponent } from './brand/brand-updater/brand-updater.component';
import { ProductCateAdderComponent } from './product-cate/product-cate-adder/product-cate-adder.component';
import { ProductCateUpdaterComponent } from './product-cate/product-cate-updater/product-cate-updater.component';
import { ProductCateResolverService } from './product-cate/product-cate-resolver.service';
import { BrandDetailResolverService } from './brand/brand-detail-resolver.service';

import { ProductAttrListComponent } from './product-attr/product-attr-list/product-attr-list.component';
import { ProductAttrEditerComponent } from './product-attr/product-attr-editer/product-attr-editer.component';
import { ProductAttrAdderComponent } from './product-attr/product-attr-adder/product-attr-adder.component';
import { ProductAttrDetialResolverService } from './product-attr/product-attr-detial-resolver.service';
// import { ProductAttrDetailComponent } from './product-attr/product-attr-detail/product-attr-detail.component';

const routes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: 'product' },
  { path: 'product', component: ProductComponent, data: { breadcrumb: '商品列表' } },
  { path: 'addProduct', component: AddProductComponent, data: { breadcrumb: '添加商品' } },
  { path: 'updateProduct', component: AddProductComponent, data: { breadcrumb: '修改商品' } },
  { path: 'productCate', component: ProductCateComponent, data: { breadcrumb: '商品分类' } },
  { path: 'addProductCate', component: ProductCateAdderComponent, data: { breadcrumb: '添加商品分类' } },
  {
    path: 'updateProductCate',
    component: ProductCateUpdaterComponent,
    data: { breadcrumb: '修改商品分类' },
    resolve: {cate: ProductCateResolverService},
  },
  { path: 'productAttr', component: ProductAttrComponent, data: { breadcrumb: '商品类型' } },
  { path: 'productAttrList', component: ProductAttrListComponent, data: { breadcrumb: '商品属性列表' } },
  { path: 'addProductAttr', component: ProductAttrAdderComponent, data: { breadcrumb: '添加商品属性' } },
  {
    path: 'updateProductAttr',
    component: ProductAttrEditerComponent,
    data: { breadcrumb: '修改商品属性' },
    resolve: { attr: ProductAttrDetialResolverService }
  },
  { path: 'brand', component: BrandComponent, data: { breadcrumb: '品牌管理' } },
  { path: 'addBrand', component: BrandAdderComponent, data: { breadcrumb: '添加品牌' } },
  {
    path: 'updateBrand',
    component: BrandUpdaterComponent,
    data: { breadcrumb: '编辑品牌' },
    resolve: { brand: BrandDetailResolverService }
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class PmsRoutingModule { }
